package com.itheima.steawmdemo;

import java.util.ArrayList;
import java.util.function.Consumer;

public class StreamDemo5 {
    public static void main(String[] args) {
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("张三丰");
        list1.add("张无忌");
        list1.add("张翠山");
        list1.add("王二麻子");
        list1.add("张良");
        list1.add("谢广坤");

//        method1(list1);
//        method2(list1);
    }

    private static void method2(ArrayList<String> list1) {
        System.out.println(list1.stream().count());
    }

    private static void method1(ArrayList<String> list1) {
    /*list1.stream().forEach(new Consumer<String>() {
        @Override
        public void accept(String s) {
            System.out.println(s);
        }
    });*/

        list1.stream().forEach(s -> System.out.println(s));
    }
}
